<?php
$total = count($this->nmsg);
$file  = Engine_Api::_()->getApi('storage', 'storage');
?>
<?php if ($total):?>
<?php $unread = array();?>
<?php foreach ($this->nmsg as $item):?>
	<?php $unread[] = $item->notification_id?>	
<?php endforeach;?>
<script type="text/javascript">
$('friend_req_count').getParent().setStyle('display', '');
$('friend_req_count').innerHTML = '<?php echo $total;?>';
var freq_msg = [<?php echo implode(', ', $unread)?>];
</script>
<?php else:?>
<script type="text/javascript">
var freq_msg = new Array();
</script>
<?php endif;?>

<ul>
<?php if (count($this->freqs)):?>
<?php foreach ($this->freqs as $item):?>
	<?php $subject = Engine_Api::_()->user()->getUser($item->resource_id)?>
    <li id="freqs_<?php echo $subject->getIdentity()?>" class = "item_content">
    	<table border="0" width="100%" cellspacing="0" cellpadding="0">
    		<tr>
    			<td valign="top" width="18%">
    				<a href="<?php echo $subject->getHref(); ?>">
    				    <?php echo $this->itemPhoto($subject, 'thumb.icon');?>
    				</a>
    				
    			</td>
    			<td valign="top" width="37%">
    				<?php echo $subject;?>
    			</td>
    			<td width="45%" valign="top" id="friend_action_<?php echo $subject->getIdentity()?>" style="text-align:right">
    				<button class="uiButtonConfirm" onclick="return doConfirm(<?php echo $subject->getIdentity()?>)"><?php echo $this->translate('Confirm')?></button>
    				<button class="uiButtonCancel" onclick="return doCancel(<?php echo $subject->getIdentity()?>)"><?php echo $this->translate('Cancel')?></button>
    			</td>
    		</tr>
    	</table>
    </li>
<?php endforeach;?>
<?php else:?>
    <div class="no_item_content"><span class="none"><?php echo $this->translate('No new friend request.')?></span></div>
<?php endif;?>
    <li>
    <a href="<?php echo $this->url(array(),'advmenusystem_friend_requests')?>" class="sfooter">
            <span><?php echo $this->translate('See All Friend Requests')?></span>
    </a>
    </li>
</ul>